package com.ls.ai;

import org.springframework.ai.chat.client.ChatClient;
import org.springframework.ai.deepseek.DeepSeekChatModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;

import java.util.Scanner;

/**
 * @Author 刘帅
 * @Date: 2025-06-29 12:06
 * @RequestID 需求单号
 * @Version 1.0
 */
@SpringBootApplication
public class SpringChatAIApplication {

    public static void main(String[] args) {
        SpringApplication.run(SpringChatAIApplication.class, args);
    }



    @Bean
    CommandLineRunner cli(ChatClient.Builder builder) {
        return args -> {
            var chat = builder.build();
            try (var scanner = new Scanner(System.in)) {
                System.out.println("\nLet's chat!");
                while (true) {
                    System.out.print("\nUSER: ");
                    System.out.println("ASSISTANT: " +
                            chat.prompt(scanner.nextLine()).call().content());
                }
            }
        };
    }
}
